<template>
	<view class="page-backgroud">
			<view>
				<input class="input-search" 
				@input="search()" v-model="searchinput"
				placeholder="  请输入报告单号" />
			</view>
		<view class="appoint-record-box" v-for="(e,i) in baogaoList" :key="e.id">
			<view class="top-title">
				<text class="left">报告单号</text>
				<text class="tuihao-button">{{e.id}}</text>
			</view>
			<view class="appoint-info">
				<text class="left balck-text">医生：</text>
				<text class="right"> {{e.yuyue.doctorName}}</text>
			</view>
			<view class="appoint-info">
				<text class="left balck-text">时间：</text>
				<text class="right"> {{e.yuyue.riqi}} {{e.yuyue.shijian}}</text>
			</view>
			<view class="appoint-info">
				<text class="left balck-text">医院：</text>
				<text class="right"> 中国医科大学附属医院 </text>
			</view>
			<view class="appoint-info">
				<text class="left balck-text">诊室：</text>
				<text class="right"> {{e.yuyue.keshiName}}</text>
			</view>
			<view>
				<text class="balck-text" style="margin-left: 18px;">症状描述：</text>
			</view>
			<view class="yisheng-jianyi-f1">
				 {{e.yuyue.zhengzhuang}}
			</view>
			<view>
				<text class="balck-text" style="margin-left: 18px;">医生建议：</text>
			</view>
			<view class="yisheng-jianyi">
				 {{e.fankui}}
			</view>
		</view>
	</view>
</template>

<script> 
	import {error} from '@/common/js/errorTips.js'
	import {
			getKeshiName,
			findyishengByid,
			quguahao,
			topingjia1,
			addpingjia,
			checkpingjiaexist,
			baogao,
			findBaoGaoByid
	} from '@/common/api/jh/doctor.js'
	var _self = 1,timer = null;
	export default {
		data() {
			return {
				doctorName:'',
				keshiName:'',
				guahaorecored: {
					riqi: '',
					shijian: ''
				},
				pingjiainfo:{
					jiuzhengbianhao:0,
					score: '我比较满意',
					jianyi: ''
				},
				canpingjia: true,
				searchinput: '',
				baogaoList: [],
				list: [],
			}
		},
		
		methods: {
			// 点击确定
			insureAppoint: function() {
				console.log("checkbox"+JSON.stringify(this.checkbox1))
				console.log(JSON.stringify(this.pingjiainfo))
				addpingjia(this.pingjiainfo.jiuzhengbianhao,
				this.pingjiainfo.score,
				this.pingjiainfo.jianyi).then(res => {
					if(res.data==1){
						uni.showToast({
							title: '评价成功',
							icon: 'success'
						})
						this.canpingjia = false
					}
				}).catch(() => {
					error('网络故障')
				})
			},
			getKeshiName(keshi){
				getKeshiName(keshi).then(res => {
					this.keshiName = res.data!=''?res.data:keshi
				}).catch(() => {
					error('网络故障')
				})
			},
			findyishengByid(yisheng){
				findyishengByid(yisheng).then(res => {
					this.doctorName = res.data.name!=''?res.data.name:yisheng
				}).catch(() => {
					error('网络故障!')
				})
			},
			search(){
				var dinput = this.searchinput;
				var data = this.list;
				if(dinput!=''){
					
					var newdata = []
					data.forEach(function(e,i){
						if(e.yyuejiuzhengid.startsWith(dinput)){
							newdata.push(e);
						}
					});
					this.baogaoList = newdata
				}else{
						this.baogaoList = data
				}
			}
		},
		onLoad() {
			baogao().then(res => {
				this.baogaoList = res.data;
				this.list = res.data;
				console.log(JSON.stringify(res.data))
			})
		}
	}
</script>

<style lang="scss">
	@import '@/common/scss/common.scss';
	@import '@/common/scss/form.scss';
	// 一个个的数据块
	.appoint-record-box {
		@include width-margin(90%, auto);
		border-radius: 6px;
		overflow: hidden;
		background-color: #FFFFFF;
		margin-top: 30rpx;

		.top-title {
			@include width-margin(90%, 80rpx);
			line-height: 80rpx;
			@include row-left-right(50%, 50%);
			@include font-style(16px, 500, $major-color);
			border-bottom: 1px solid $uni-border-color;
		}

		.appoint-info {
			@include width-margin(90%, 70rpx);
			line-height: 70rpx;
			@include row-left-right(20%, 80%);
			@include font-style(16px, 500, $gray-color);
			align-items: center;

			// 当用户还没到就就诊的时间看到的
			.green-text {
				@include font-style(16px, 500, #6EC823);
			}

			// 有失信时的状态颜色
			.red-text {
				@include font-style(16px, 500, #CE1229);
			}

			// 排队号的颜色
			.balck-text {
				@include font-style(16px, 500, #000000);
			}

			// /取消预约按钮
			.cancel-button {
				float: right;
				width: 60px;
				height: 25px;
				line-height: 25px;
				font-size: 14px;
				font-family: '宋体';
				color: #55aaff;
				margin-left: 60%;
				margin-top: 10px;
				margin-bottom: 10px;
			}
		}
	}
	
	
	.tuihao-button{
		float: right;
		height: 20px;
		line-height: 20px;
		font-size: 14px;
		font-family: '宋体';
		color: #55aaff;
		margin-left: 31%;
		margin-top: 10px;
		margin-bottom: 10px;
	}

	.appoint-record-box:last-child {
		margin-bottom: 30rpx;
	}
	.loading {
		text-align: center;
		line-height: 80px;
		font-family: '宋体';
		color: #a6a6a6;
	}
	.checkbox-class{
		margin-left: 30px;
		color: blue;
	}
	.checkbox-text-class{
		color: #7A7A7A;
		margin-left: 20px;
		font-size: 18px;
		font-family: '宋体';
	}
	.pingjia{
		height: 100px;
		background-color: white;
		border: 1px solid #55aaff;
		margin: 5px;
		width:95%;
	}
	.pingjia-bu{
		width: 90%;
		margin: 15px;
		background-color: #55aaff;
	}
	.input-search{
		margin: 10px;
		background-color: white;
		border-radius: 5px;
		padding-top:10px;
		text-align: center;
		padding-bottom: 5px;
	}
	.yisheng-jianyi-f1{
		color: #888888;
		margin-left: 25px ;
	}
	.yisheng-jianyi{
		margin-left: 20px ;
		color: #888888;
	}
</style>
